#ifndef __CREDISOP__
#define __CREDISOP__

#include <string.h>
#include "credis.h"

typedef struct SServerInfo
{
    char szIp[128];
    int iPort; 

    SServerInfo()
    {
        memset( szIp, 0, sizeof(szIp) );
        iPort = 0;
    }
}ServerInfo;

class CRedisOp
{
public:
	CRedisOp();
	~CRedisOp();

    int SetData(const char * key, const char * val, unsigned int iValueLen);

    int SetDataTest(const char * key, const char * val);

    int GetResult( const char * key, char ** vResult );

	void SetInfo(void * args);

	bool GetStatus();

    bool ReConnect();

    void SetStatusFail();

	bool Init(void * args);

    void SetKeepAlive( const char * key, int iTimeOut=30*60 );

private:
	REDIS m_redis;

	//REDIS_INFO info;

	bool m_ConnStatus;

	void * m_serverInfo;
};


#endif
